scripting --> how can I set a certain studio?

Hi,
I am trying to get my first keyshot script running in the latest non-beta Keyshot 2023.
I want to turn on and off different model-sets as well as various studios and render out those situations.
After reading a lot and watching the few videos I managed to get the informations on the available studios and so on. But I have not been able to change respectively turn on and off these studios.

here is the shortest excerpt of what I did and even failed there as the Studio Named PT02 didn’t get actived although the script was ended successfully.

import os, re, sys
import os.path

#Read the available Studio Names and print them in the console
studio_names = lux.getStudios()
print(studio_names)

#setActiveStudio
lux.setActiveStudio = (‘studio2’)
print(“set Studio 2 .–> just to have some feedback after the studio activation”)

Please, as the above shown lux.setActiveStudio = (‘studio2’) is not working, can anybody give me a hint of what I am missing?

Thanks in advance

Here you are trying to assign a method to a tuple with a str.

In Python you call the methods and pass the parameters with the expected types, just like you do with print(something)

Try it like this:

lux.setActiveStudio("studio2")  # Without the "="

or:

# You can explicitly assign the value you want to the parameter
# so the code is easier to read after a while.
lux.setActiveStudio(name="studio2")
2 Likes

Hey,
Please be aware that studio scripting right now only is available in the BETA (soon to be released).

/Synje

Hi Rui Antunes, thanks a lot :slight_smile: I gave it a try and it worked well.
Not sure why I used the equal mark … anyhow thanks a lot again. I guess I will improve easier from now on.

Stephan

1 Like

Hi Synje,
yes, I read something about the added Studio Scripting in the Beta section of the luminaries forum.
However the above mentioned setActiveStudio is already inside the manual and it also works like a charm when I just tested it on my installed Keyshot 2023.2 Pro (Version 12.1.1 Build 11 (4.8.1)).

As I read in the latests description of the Highlights of Keyshot 2023.3 Beta Update 2 [ (12.2.0.180) some new scripting functionality is going to come --> very nice and for sure useful :slight_smile:

  • Added ability to create/modify/remove studios via scripting
  • Added ability to access/modify/remove cameras as scene nodes via scripting

I am just starting with the scripting now which is a rough … but I will make it :wink:

Stephan